using System;
using System.Globalization;
using System.Reflection.Emit;

namespace RaisingStudio.SmallBasicCompiler.Expressions
{
	[Serializable]
	public class NegativeExpression : Expression
	{
		public TokenInfo Negation
		{
			get;
			set;
		}
		public Expression Expression
		{
			get;
			set;
		}
		public override void AddSymbols(SymbolTable symbolTable)
		{
			if (this.Expression != null)
			{
				this.Expression.AddSymbols(symbolTable);
			}
		}
		public override void EmitIL(CodeGenScope scope)
		{
			this.Expression.EmitIL(scope);
			scope.ILGenerator.EmitCall(OpCodes.Call, scope.TypeInfoBag.Negation, null);
		}
		public override string ToString()
		{
			return string.Format(CultureInfo.CurrentUICulture, "-{0}", new object[]
			{
				this.Expression
			});
		}
	}
}
